package com.foreknow.tijian.service.Impl;

import com.foreknow.tijian.dao.SetmealDao;
import com.foreknow.tijian.dao.Impl.SetmealDaoImpl3;
import com.foreknow.tijian.po.Setmeal;
import com.foreknow.tijian.service.SetmealService;
import com.foreknow.tijian.util.DBUtil;

import java.sql.SQLException;
import java.util.List;

public class SetmealServiceImpl implements SetmealService {
    @Override
    public List<Setmeal> getSetmealByType(int type)  {
        SetmealDao setmealDao = new SetmealDaoImpl3();
        List<Setmeal> list=null;
        try {
            list= setmealDao.getSetmealByType(type);
        } catch (SQLException e) {
            throw new RuntimeException(e);
        }finally {
            DBUtil.close();
        }
        return list;
    }

    @Override
    public Setmeal getSetmealById(Setmeal setmeal) {
        SetmealDao setmealDao = new SetmealDaoImpl3();
        //int id=setmeal.getSmId();

        try {
            setmeal= setmealDao.getSetmealById(setmeal);
        } catch (SQLException e) {
            throw new RuntimeException(e);
        }finally {
            DBUtil.close();
        }
        return setmeal;
    }
}



